#include<iostream>
using namespace std;
const int N = 20;
int arr[N];
int n, l, r, x;
int ans;
bool st[N];
void dfs(int u, int sum, int mi, int ma)
{
	if (u == n + 1) {
		if (sum >= l && sum <= r && ma - mi >= x) {
			ans++;
		}
		return;
	}
	for (int i = 1; i <= n; i++) {
		if (!st[i]) {
			st[i] = 1;
			int t1 = min(mi, arr[i]);
			int t2 = max(ma, arr[i]);
			dfs(u + 1, sum + arr[i], t1, t2);
			st[i] = 0;
		}
	}
}
int main()
{
	cin >> n >> l >> r >> x;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	/*int k = 1e9;
	dfs(0, 0, k, 0);
	cout << ans << endl;*/
	for (int i = 0; i < 1 << n; i++) {
		int cnt = 0, mi = 1e9, ma = 0, sum = 0;
		for (int j = 0; j < n; j++) {
			if (i >> j & 1) {
				cnt++;
				mi = min(mi, arr[j]);
				ma = max(ma, arr[j]);
				sum += arr[j];
			}
		}
		if (cnt == 1)continue;
		if (ma - mi >= x && sum >= l && sum <= r)ans++;
	}
	cout << ans << endl;
	return 0;
}